package com.baizhi.chario;

import java.io.*;

/**
 * 通过字符流Copy文件
 *  只能copy 纯文本内容， 如果编码集不一样不能解决
 */
public class Copy3 {
    public static void main(String[] args) throws IOException {

        long start = System.currentTimeMillis();

        //文本输入流
        FileReader fr = new FileReader("F:\\天龙八部.txt");
        BufferedReader br = new BufferedReader(fr); //缓冲字符输入流


        //文本输出流
        FileWriter fw = new FileWriter("./javase_io/天龙八部_copy.txt");
        BufferedWriter bw = new BufferedWriter(fw);

        int d;
        while((d=br.read())!=-1){
            bw.write(d);
        }

        bw.close();
        br.close();

        long end = System.currentTimeMillis();

        System.out.println("拷贝完毕，耗时："+ (end-start)+"ms");

    }
}
